<%@include file="/header/head.jsp" %>
<jsp:include page="/header/header.jsp">
	<jsp:param value="List of Posts" name="title"/>
</jsp:include>

<!-- end of menu_wrapper -->
<div id="content">
	<a href="<spring:url value='/' />"> Home </a><br/>
	<a href="<spring:url value='/post/edit' />"> Create New Post </a><br/>
	<a href="<c:url value="/j_spring_security_logout" />">Logout</a>
	
	<table width="80%" border="1" cellspacing="0" cellpadding="5">
	        <tr>
	            <th>No</th>
	            <th>Title</th>
	            <th>Body</th>
	            <th>Created By</th>
	            <th>&nbsp;</th>
	        </tr>
			<c:choose>
	            <c:when test="${entities != null}">
	                <c:forEach var="post" items="${entities}" varStatus="counter">
	                    <tr>
	                        <td>${counter.index + 1}</td>
	                        <td>${post.title}</td>
	                        <td>${post.body}</td>
	                        <td>${post.owner.userName}</td>
	                        <td><div align="center">
	                        	<a href="<spring:url value='/post/show'/>?id=${post.id}">Show</a> /
	                            <a href="<spring:url value='/post/edit'/>?id=${post.id}">Edit</a> /
	                            <a href="<spring:url value='/post/delete'/>?id=${post.id}">Delete</a></div>
	                        </td>
	                    </tr>
	                </c:forEach>
	            </c:when>
	        </c:choose>
	        
	</table>
</div>
 
 <%@include file="/footer/footer.jsp" %>
 